/*
package com.itheima.reggie.aop;

import com.itheima.reggie.common.UserHolder;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;
import java.time.LocalDateTime;
//
//@Slf4j
//@Component
//@Aspect
//public class CommonColumnAdvice {
//
//    @Pointcut("execution(* com.itheima.reggie.controller.*Controller.update*(..))" +
//              "||" +
//              "execution(* com.itheima.reggie.controller.*Controller.save*(..))")
//    public void pt(){}
//
//    @Around("pt()")
//    public Object modifyColumn( ProceedingJoinPoint pjp ){
//        log.info("aop执行了........");
//        Object proceed = null;
//        try {
//            //拿到Employee参数对象
//            Object[] args = pjp.getArgs();
////            Object obj = args[0]; //Employee Category
//            CommonEntity obj = (CommonEntity) args[0];
////            Class<?> aClass = obj.getClass();
//            String methodName = pjp.getSignature().getName();
//            Long id = UserHolder.get();
            if (methodName.startsWith("save")){
                obj.setCreateTime(LocalDateTime.now());
                obj.setCreateUser(id);
            */
/*    //新增
                //setCreateTime(LocalDateTime.now())
                Method setCreateTime = aClass.getMethod("setCreateTime", LocalDateTime.class);
                setCreateTime.invoke(obj,LocalDateTime.now());
                Method setCreateUser = aClass.getMethod("setCreateUser", Long.class);
                setCreateUser.invoke(obj,1L);*//*

            }
            obj.setUpdateTime(LocalDateTime.now());
            obj.setUpdateUser(id);
       */
/*     Method setUpdateTime = aClass.getMethod("setUpdateTime", LocalDateTime.class);
            setUpdateTime.invoke(obj,LocalDateTime.now());

            Method setUpdateUser = aClass.getMethod("setUpdateUser", Long.class);
            setUpdateUser.invoke(obj,1L);*//*

            proceed = pjp.proceed(args);
        } catch (Throwable throwable) {
                throwable.printStackTrace();
        }
        return proceed;
    }
}
*/
